package top.jbxie.raft.current;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

public class SleepHelper {
    private static final Logger LOGGER = LoggerFactory.getLogger(SleepHelper.class);

    /**
     * 线程休眠，单位毫秒
     * @param ms
     */
    public static void sleep(int ms) {
        try {
            Thread.sleep(ms);
        } catch (InterruptedException e) {
            LOGGER.warn(e.getMessage());
        }

    }

    /**
     * 线程休眠，单位秒
     * @param seconds
     */
    public static void sleep2(int seconds) {
        try {
            TimeUnit.SECONDS.sleep(seconds);
        } catch (InterruptedException e) {
            LOGGER.warn(e.getMessage());
        }

    }
}
